Skip to content

Docs, tests, and CI: API reference, unit test coverage, and documentation updates#71

Merged
charliekilpatrick merged 8 commits intomainfrom
dev
Mar 6, 2026
Merged

Docs, tests, and CI: API reference, unit test coverage, and documentation updates#71
charliekilpatrick merged 8 commits intomainfrom
dev

Conversation

@charliekilpatrick
Copy link
Collaborator

@charliekilpatrick charliekilpatrick commented Mar 2, 2026

Description

This PR merges the dev branch into main, bringing in Sphinx API documentation, a larger unit test suite with integration markers, CI/workflow updates, and refreshed README/contributing docs.

Documentation

  • Sphinx API reference added under docs/source/api/: generated RST for all instruments (BINOSPEC, DEIMOS, F2, FOURSTAR, GMOS, IMACS, LRIS, MMIRS, MOSFIRE, base instrument), primitives (absphot, calibration, image_procs, photometry, solve_wcs, sort_files), scripts (download_anet_index, download_gemini_data, download_keck_data, main_pipeline), and utils (logger, options, utilities).
  • Installation and index (docs/source/installation.rst, docs/source/index.rst) updated with testing instructions (unit vs integration), links to README/CONTRIBUTING, and deployment note.
  • docs/DEPLOY.md added with steps to enable GitHub Pages and deploy docs to https://ciera-transients.github.io/POTPyRI/.
  • README updated: testing (unit vs integration, CI behavior), documentation section (online + local + deploy), and contributing (dev branch).
  • CONTRIBUTING.md updated: branching from dev, offline test command, and PR target branches.

Testing

  • Integration markers: Five tests that download fixtures from Google Drive are now @pytest.mark.integration (e.g. test_absphot, test_cal, test_photometry, test_sort, test_wcs_integration). Run pytest tests -m "not integration" for unit-only (no network).
  • New unit tests:
    • tests/test_instruments.pyinstrument_getter (unsupported instrument), Instrument base and GMOS: match_type_keywords, needs_sky_subtraction, getters (pixscale, rdnoise, gain, target, filter, exptime, ampl, binning, out_size, time, number, instrument_name, catalog), format_datasec, raw_format, naming helpers (stk/sci/bkg, mbias/mdark/mflat/msky).
    • tests/test_options.pyinit_options, add_paths (raises when path missing, creates dirs).
    • tests/test_utilities.pyfind_catalog (PS1, 2MASS, SDSS, UKIRT, SkyMapper, unsupported filter), is_number, parse_coord (degrees, sexagesimal, invalid).
    • tests/test_image_procs.pytest_create_error for image_procs.create_error.
  • Bug fix: potpyri.utils.utilities.find_catalog early returns now consistently return a 6-tuple (catalog, catalog_ID, ra, dec, mag, err) to match the docstring and final return.

CI and workflows

  • Build and Test (.github/workflows/build-test.yml): runs pytest -m "not integration" so CI does not depend on external fixture downloads.
  • Documentation (.github/workflows/documentation.yml): deploy step runs only on push to main (not on pull_request), so PRs still build docs without updating the live site.

Environment and packaging

  • Conda env name standardized to potpyri in environment.yml and related docs (replacing potpyri_test).
  • pyproject.toml and package metadata/scripts remain aligned with current layout.

Scope

  • ~80 files changed; substantial additions in potpyri/ (instruments, primitives, utils), tests/, and docs/.
  • No intended change to the documented user workflow: main_pipeline INSTRUMENT DATA_PATH and options are unchanged.
  • Unit test count (excluding integration): 60. All pass with pytest tests -m "not integration".

Checklist

  • Unit tests pass: pytest tests -m "not integration"
  • Docs build locally: cd docs && make html
  • README and CONTRIBUTING reflect current setup

- Introduced test_create_error to validate the output of the create_error function.
- Enhanced test coverage for image processing functionalities.
- Updated README and CONTRIBUTING.md for clarity on testing procedures and documentation deployment.
- Added unit tests for create_error function to ensure expected behavior.
- Enhanced test_image_procs.py for better coverage of image processing features.
- Revised README and CONTRIBUTING.md to clarify testing guidelines and documentation processes.
- Added additional unit tests for create_error function to improve coverage.
- Further refined test_image_procs.py for comprehensive testing of image processing.
- Updated README and CONTRIBUTING.md to provide clearer instructions on testing and documentation practices.
…tions

- Updated find_catalog to correctly handle K, Ks, and Kspec filters for 2MASS, mapping them to the K-band columns.
- Enhanced convert_filter_name to return 'K' for K, Ks, and Kspec filters.
- Added unit tests to validate the new behavior for 2MASS K-band filters in test_utilities and test_absphot.
…ame loading

- Added a new helper function to read calibration FITS files into CCDData without parsing WCS, addressing issues with ill-conditioned WCS keywords.
- Refactored bias, dark, flat, and sky frame loading methods to utilize the new function, improving code clarity and reducing redundancy.
- Introduced a new function, _sanitize_calibration_header, to remove WCS and coordinate keywords from calibration headers, ensuring safe writing of calibration files.
- Updated bias, dark, flat, and sky frame writing methods to utilize the new sanitization function, preventing potential InvalidTransformError during WCS parsing.
- Improved logging to ensure messages are only displayed when logging is enabled.
- Introduced tests for _sanitize_calibration_header and _read_calibration_ccd functions to ensure proper handling of calibration FITS files and header sanitization.
- Added tests for loading bias, dark, flat, and sky frames, verifying that they correctly utilize the new calibration loading methods.
- Implemented additional tests for sky subtraction and static mask filename retrieval to enhance overall test coverage.
- Updated the _read_calibration_ccd function to improve efficiency in loading calibration FITS files.
- Refactored related loading methods for bias, dark, flat, and sky frames to streamline the process.
- Added new unit tests to ensure robust validation of calibration frame loading and processing.
@charliekilpatrick charliekilpatrick merged commit 43ab7ab into main Mar 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant